package com.wpp.dubbo.provider.service.impl;

import com.wpp.dubbo.provider.service.TPService;
import org.apache.dubbo.config.annotation.Service;

import java.util.Random;
import java.util.concurrent.TimeUnit;

/**
 * @Classname TPServiceImpl
 * @Description
 * @Date 2021/1/19 22:39
 * @Created by wpp25
 */
@Service
public class TPServiceImpl implements TPService {

    @Override
    public void methodA() {
        sleepLessThan100ms();
        System.out.println("this is methodA");
    }

    @Override
    public void methodB() {
        sleepLessThan100ms();
        System.out.println("this is methodB");

    }

    @Override
    public void methodC() {
        sleepLessThan100ms();
        System.out.println("this is methodC");
    }

    private void sleepLessThan100ms() {
        try {
            Thread.sleep(new Random().nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
